﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using underwater.Processes;

namespace underwater.OS
{
    class DrawProcesses
    {
        public static void DrawBubble(Process proc, SpriteBatch sprite)
        {
            sprite.Draw(Loader.Textures[TextureEnum.Bubble], OpSys.GetSR(proc.position),
                new Rectangle(0, 0, Loader.Textures[TextureEnum.Bubble].Width,
                    Loader.Textures[TextureEnum.Bubble].Height), Color.White);
        }

        public static void DrawCloud(Process proc, SpriteBatch sprite)
        {
            sprite.Draw(Loader.Textures[TextureEnum.Cloud1] , 
                OpSys.GetSR(proc.position),
                new Rectangle(0, 0, Loader.Textures[TextureEnum.Cloud1].Width,
                    Loader.Textures[TextureEnum.Cloud1].Height), Color.White);
        }

        public static void DrawWeed(Process proc, SpriteBatch sprite)
        {
            sprite.Draw(Loader.Textures[TextureEnum.Bubble], OpSys.GetSR(proc.position),
                new Rectangle(0, 0, Loader.Textures[TextureEnum.Bubble].Width,
                    Loader.Textures[TextureEnum.Bubble].Height), Color.White);
        }

        public static void DrawSmallFish(Process proc, SpriteBatch sprite)
        {
            sprite.Draw(Loader.Textures[TextureEnum.Bubble], OpSys.GetSR(proc.position),
                new Rectangle(0, 0, Loader.Textures[TextureEnum.Bubble].Width,
                    Loader.Textures[TextureEnum.Bubble].Height), Color.White);
        }

        public static void DrawShark(Process proc, SpriteBatch sprite)
        {
            sprite.Draw(proc.Satiety == 0 ? Loader.Textures[TextureEnum.SharkSwem] : Loader.Textures[TextureEnum.SharkEat], OpSys.GetSR(proc.position), proc.animat, Color.White, 0,
                Vector2.Zero, proc.course == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0);
        }

        public static void AnimatForShar(Process proc, GameTime gameTime)
        {
            proc.timeElapsed += gameTime.ElapsedGameTime.Milliseconds;
            if (proc.timeElapsed > proc.timeForFrame)
            {
                proc.currentFrame = (proc.currentFrame + 1) % proc.Frames;
                proc.timeElapsed = 0;
            }
            proc.animat = new Rectangle(proc.currentFrame * proc.Wframe, 0, proc.Wframe, proc.Hframe);
        }

        public static void DrawVioletFish(Process proc, SpriteBatch sprite)
        {
            sprite.Draw(Loader.Textures[TextureEnum.VioletFish], OpSys.GetSR(proc.position), proc.animat, Color.White, 0,
               Vector2.Zero, proc.course == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0);
        }

        public static void AnimatForVioletFish(Process proc, GameTime gameTime)
        {
            proc.timeElapsed += gameTime.ElapsedGameTime.Milliseconds;
            if (proc.timeElapsed > proc.timeForFrame)
            {
                proc.currentFrame = (proc.currentFrame + 1) % proc.Frames;
                proc.timeElapsed = 0;
            }
            proc.animat = new Rectangle(proc.currentFrame * proc.Wframe, 0, proc.Wframe, proc.Hframe);
        }

        public static void DrawTurquoiseFish(Process proc, SpriteBatch sprite)
        {
            sprite.Draw(Loader.Textures[TextureEnum.TurquoiseFish], OpSys.GetSR(proc.position), proc.animat, Color.White, 0,
               Vector2.Zero, proc.course == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0);
        }

        public static void AnimatForTurquoiseFish(Process proc, GameTime gameTime)
        {
            proc.timeElapsed += gameTime.ElapsedGameTime.Milliseconds;
            if (proc.timeElapsed > proc.timeForFrame)
            {
                proc.currentFrame = (proc.currentFrame + 1) % proc.Frames;
                proc.timeElapsed = 0;
            }
            proc.animat = new Rectangle(proc.currentFrame * proc.Wframe, 0, proc.Wframe, proc.Hframe);
        }

        public static void DrawSkeleton(Process proc, SpriteBatch sprite)
        {
            sprite.Draw(Loader.Textures[TextureEnum.Bubble], OpSys.GetSR(proc.position),
                new Rectangle(0, 0, Loader.Textures[TextureEnum.Bubble].Width,
                    Loader.Textures[TextureEnum.Bubble].Height), Color.White);
        }
    }
}
